package com.szxy.backend.item.controller;

import com.netflix.discovery.converters.Auto;
import com.szxy.backend.item.service.ItemCategoryService;
import com.szxy.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Auther:zwer
 * @Date:2019/9/7 16:12
 * @Description:com.szxy.backend.item.controller
 * @Version:1.0
 **/
@RestController
@RequestMapping("/backend/itemCategory")
public class ItemCategoryController {

    @Autowired
    private ItemCategoryService itemCategoryService;

    /**
     *  查询商品分类目录
     * @param id  商品分类父 ID
     * @return
     */
    @RequestMapping(value = "/selectItemCategoryByParentId",method = RequestMethod.POST)
    public Result selectItemCategoryByParentId(@RequestParam(defaultValue = "0") Long id){
        try {
            return this.itemCategoryService.selectItemCategoryByParentId(id);
        }catch (Exception e){
            e.printStackTrace();
        }
        return Result.build(500,"查询出错");
    }

}
